<%--
  Created by IntelliJ IDEA.
  User: yanchao
  Date: 2021/11/7
  Time: 下午4:13
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>还款列表 - 助学贷款系统</title>
    <link rel="stylesheet" href="./static/layui/css/layui.css">
    <link rel="stylesheet" href="./static/admin/css/style.css">
    <script src="./static/layui/layui.js"></script>
    <script src="./static/js/jquery-3.3.1.min.js"></script>
    <script src="./static/js/vue.min.js"></script>
    <script src="./static/admin/js/user_config.js"></script>
    <c:if test="${sessionScope.user.status == 0}"><script language="javascript">alert('您的账号已被封禁，暂时无法使用此功能，请在账号维护中申请解封！');window.location.href="userInfo.do";</script></c:if>
    <c:if test="${sessionScope.user.status == 2}"><script language="javascript">alert('您的账号解封申请已提交，暂时无法使用此功能，请等待管理员审核！');window.location.href="userInfo.do";</script></c:if>
</head>
<body class="p20">


<table class="layui-table layui-form">

    <thead>
    <tr>
        <th>ID</th>
        <th>项目名称</th>
        <th>姓名</th>
        <th>性别</th>
        <th>年龄</th>
        <th>学校</th>
        <th>待还款额</th>
        <th>还款状态</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <c:forEach items="${sessionScope.repayList}" var="apply" varStatus="status">
        <tr class="id36567">
            <td>${apply.id}</td>
            <td>${apply.project}</td>
            <td>${sessionScope.user.realname}</td>
            <td>${sessionScope.user.sex}</td>
            <td>${sessionScope.user.age}</td>
            <td>${sessionScope.user.school}</td>
            <td>${apply.amount}</td>
            <c:if test="${apply.repaystatus == 0}"><td>未还款</td></c:if>
            <c:if test="${apply.repaystatus == 1}"><td>已还款</td></c:if>
            <c:if test="${apply.repaystatus == 2}"><td>已放款</td></c:if>
            <c:if test="${apply.repaystatus == 3}"><td>未放款</td></c:if>
            <c:if test="${apply.repaystatus == 4}"><td>已完成</td></c:if>

            <c:if test="${apply.repaystatus == 4}"><td><button type="button" class="layui-btn layui-btn-sm layui-btn-disabled" onclick="">确认收款</button></td></c:if>
            <c:if test="${apply.repaystatus == 3}"><td><button type="button" class="layui-btn layui-btn-sm layui-btn-disabled" onclick="">确认收款</button></td></c:if>
            <c:if test="${apply.repaystatus == 2}"><td><button type="button" class="layui-btn layui-btn-sm " onclick="userConfirmReceiptApply(${apply.id})">确认收款</button></td></c:if>
            <c:if test="${apply.repaystatus == 0}"><td><button type="button" class="layui-btn layui-btn-sm " onclick="userRepay(${apply.id})">还款申请</button></td></c:if>
            <c:if test="${apply.repaystatus == 1}"><td><button type="button" class="layui-btn layui-btn-sm " onclick="userRepayHistory(${apply.id})">还款记录</button></td></c:if>
        </tr>
    </c:forEach>
    </tbody>
</table>
<script src="./static/admin/js/script.js"></script>
<script type="text/javascript" language="javascript">
    function userRepay(id) {
        window.location.href="userRepay?id="+id;
    }
    function userRepayHistory(id) {
        window.location.href="userRepayHistory?id="+id;
    }
    function userConfirmReceiptApply(id) {
        var message=confirm("你确定要确认收款吗？");
        if(message===true)
        {
            window.location.href="/userConfirmReceiptApply.do?id=" + id;
        }
        else if(message==false)
        {
            window.location.href="/userRepayList.do";
        }
    }
</script>
</body>
</html>
